﻿using System;
using System.Data;
using System.IO;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BLL;
using Model;
using Ysb.Components;


using DAL;
using Aspose.Cells;
public partial class Admin_BillManaga : System.Web.UI.Page
{
    WayBill mbill = new WayBill();
    WayBillService mbills = new WayBillService();
    string gvUniqueID = String.Empty;
    const string vsKey = "searchCritriam";
    Tools newtools = new Tools();
    protected void Page_Load(object sender, EventArgs e)
    {
  
            if (!Page.IsPostBack)
            {
               

                if (Session["Surl"] != null)
                {
                    DataLoad(Session["Surl"].ToString());
                }
                else
                {
				        string sql = "1=1" ;
    

		 sql += " and AccountNo = 'LaxSF'";
		 
       Session["Surl"] = sql;
                             DataLoad(Session["Surl"].ToString());
                }
            }

        else
        {
            Response.Redirect("BillManaga7.aspx");
        }

    }
    private void DataLoad(string sql)
    {

        ViewState["sql"] = sql;
        NewsPage.RecordCount = new PublicSqlService().GetCoun("BID", "Tbl_WayBill", sql);

        BindData(sql);
    }
    private void BindData(string sql)
    {

        string getword = "Sep,TrackingNo,NoOfPiece,UPEXState,Sender,Receiver,ChargedWt,FlightNo,BillState,Total,CreateDate,Memo1,StateID,SepTotal,SepChargedWt";
        billlist.DataSource = new PublicSqlService().GetDataPage("Tbl_WayBill", NewsPage.RecordCount, NewsPage.PageSize, NewsPage.CurrentPageIndex, "BID", 1, true, getword, sql);
        billlist.DataBind();



    }
    protected void NewsPage_PageChanged(object sender, EventArgs e)
    {

        BindData((string)ViewState["sql"]);

    }

    public DataTable getrpro(string tn)
    {
        string getword = "SepNo,TrackingNo,SBState,SendBy,CHNReceiver,Pieces,ChargedWt,FlightNo,CreateDate,Logo,Memo1,Total,State";
        return new PublicSqlService().GetData(getword, "Tbl_SepBill", "TrackingNo='" + tn.Trim() + "'");
    }




    protected void searchbtn_Click(object sender, ImageClickEventArgs e)
    {
        string sql = "1=1" ;
    
 
		
		 sql += " and AccountNo = 'LaxSF'";
		 

       //     and AccountNo = 'LAX90018'
        //
        Session["Surl"] = sql;
        Response.Redirect("BillManaga7.aspx?page=1");
        //   DataLoad(sql);


    }

}

